package cn.mulanbay.log.persistent.service;

import cn.mulanbay.common.bean.PageSearch;
import cn.mulanbay.persistent.entity.OperationLog;
import cn.mulanbay.persistent.mapper.OperationLogMapper;
import cn.mulanbay.persistent.query.QueryBuilder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OperationLogService extends ServiceImpl<OperationLogMapper, OperationLog>  {

    @Autowired
    OperationLogMapper operationLogMapper;

    /**
     * 获取用户列表
     *
     * @param us
     * @return
     */
    public Page<OperationLog> getDataList(PageSearch us){
        Page<OperationLog> pp = new Page<>(us.getPage(),us.getPageSize());
        QueryWrapper qw = QueryBuilder.build(us);
        pp.addOrder(OrderItem.desc("occur_end_time"));
        pp = baseMapper.selectPage(pp,qw);
        return pp;
    }

}
